<template>
	<div>
		<el-table :data="userInfo" height="600" border style="width: 100%;">
			<el-table-column prop="uid" label="用户id" width="150" >
			</el-table-column>
			<el-table-column prop="uname" label="用户姓名" width="150">
			</el-table-column>
			<el-table-column prop="upwd" label="用户密码" width="150">
			</el-table-column>
			<el-table-column prop="uemail" label="用户邮箱">
			</el-table-column>
			<el-table-column label="操作" width="250" fixed="right">
				<template slot-scope="scope">
					<el-button @click="handleClick(scope.row)" type="text" size="small" icon="el-icon-document">详情</el-button>
					<!-- <el-button @click="handleClick(scope.row)" type="text" size="small">删除</el-button> -->
				</template>
			</el-table-column>
		</el-table>
		<el-input v-model="inputname" placeholder="请输入用户昵称" style="width: 30%;" fixed="left"></el-input><el-button type="primary" @click="searchname()" icon="el-icon-search">搜索</el-button>
		&nbsp;&nbsp;&nbsp;
		<el-input v-model="inputid" placeholder="请输入用户id" style="width: 30%;" fixed="right"></el-input><el-button type="primary" @click="searchid()" icon="el-icon-search">搜索</el-button>
		<!-- <mealInfoadd></mealInfoadd> -->
		<!-- <staffInfoDetail :empInfo="empInfos"></staffInfoDetail> -->
		<!-- 	<bbsInfoDetail :bbsInfo="bbsInfos"></bbsInfoDetail> -->
		<userInfoDetail :userdetails="userdetails"></userInfoDetail>
	</div>
</template>
<script>
	// import mealInfoDetail from '@/components/meal_info/Meal_info_detail.vue'
	// import mealInfoadd from '@/components/meal_info/Meal_info_add.vue'
	// import staffInfoDetail from '@/components/staff_info/Staff_info_detail.vue'
	import userInfoDetail from '@/components/user_info/user_info_detail.vue'

	import {
		request
	} from "network/request.js"

	export default {
		components: {
			userInfoDetail
		},
		data() {
			return {
				userdetails: {
					"bbsinfoList": [{
						"bbsid": 0,
						"bbsremark": "string",
						"bbsstage": "string",
						"bbstime": "2019-10-10T11:19:11.019Z",
						"bbstype": "string",
						"uid": 0
					}],
					"longorderList": [{
						"longcreatetime": "2019-10-10T11:19:11.019Z",
						"longdetail": "string",
						"longedtime": "2019-10-10T11:19:11.019Z",
						"longid": 0,
						"longprice": 0,
						"longremark": "string",
						"longremark2": "string",
						"longretime": "2019-10-10T11:19:11.019Z",
						"longstate": "string",
						"mealid": 0,
						"u2id": 0,
						"uid": 0
					}],
					"majororderList": [{
						"major0remark2": "string",
						"majorcreatetime": "2019-10-10T11:19:11.019Z",
						"majordetail": "string",
						"majorid": 0,
						"majormealid": 0,
						"majorprice": 0,
						"majorremark": "string",
						"majorstate": "string",
						"u2id": 0,
						"uid": 0
					}],
					"shortorderList": [{
						"longremark": "string",
						"longremark2": "string",
						"longstate": "string",
						"mealid": 0,
						"shortcreatetime": "2019-10-10T11:19:11.019Z",
						"shortdetail": "string",
						"shortid": 0,
						"shortprice": 0,
						"u2id": 0,
						"uid": 0
					}],
					"userbaseinfo": {
						"uemail": "string",
						"uid": 0,
						"umeb": "string",
						"umebnum": 0,
						"uname": "string",
						"uphone": "string",
						"upwd": "string",
						"uremark": "string",
						"uremark2": "string",
						"uremark3": "string",
						"ustate": "0"
					},
					"userinfo2List": [{
						"u2addressinfo": "string",
						"u2baseaddress": "string",
						"u2id": 0,
						"u2name": "string",
						"u2phone": "string",
						"u2remark": "string",
						"u2state": "string",
						"u2type": "string",
						"uid": 0
					}]
				},
				inputname:'',
				inputid:'',
				userInfos: '',
				empInfos: '',
				userInfo: []
			}
		},
		methods: {
			searchid(){
					request({
						url: '/User/UserInfo',
						method: 'get',
						params: {
							// id:this.$store.state.mealid
							uid: this.inputid
						}
					}).then(res => {
						this.userInfo=[]
						this.userInfo.push(res.data)
					})
			},
			searchname(){
					request({
						url: '/User/Userinfoname',
						method: 'get',
						params: {
							// id:this.$store.state.mealid
							name: this.inputname
						}
					}).then(res => {
						this.userInfo=res.data						
					})
			},
			 handleClick(row) {
				// console.log(row.empid)
				request({
					url: '/User/Userdetail',
					method: 'get',
					params: {
						// id:this.$store.state.mealid
						uid: row.uid
					}
				}).then(res => {
					console.log(res.data)
					// let emptypes = ["长期服务", "短期服务"];
					// request({
					// 	url: '/Meal/majorMeals',
					// 	method: 'get',
					// }).then(res1 => {
					// 	res1.data.forEach(s => {
					// 		if (res.data.emptype == s.majormealid.toString()) {
					// 			res.data.emptype = s.majormealremark
					// 		}
					// 	})
					// 	if (res.data.emptype == "A") {
					// 		res.data.emptype = "长期服务"
					// 	} else if (res.data.emptype == "B") {
					// 		res.data.emptype = "短期服务"
					// 	}
					// 	this.empInfos = res.data
					// 	this.$store.commit("updateStaffInfoflag", true)
					// })
					this.userdetails=res.data;
						this.$store.commit("updateUserInfoflag", true)
				})
			 }
		}

	}
</script>
<style>
	el-table-column {
		height: 50px;
	}

	.el-main {
		line-height: 20px;
	}
</style>
